import React, { PureComponent } from 'react';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import './style.scss';
import { actionCreators } from './store';

class PersonalTeacher extends PureComponent {
    render() {
        const { teacherData, courseData } = this.props;
        return (
            <div className="personalTeacher">
               <div className="personalTeacherContent">
                <div className="contentTitle">
                    <div className="titleIcon">
                    <img src="http://mobuz-mp.cdn.bcebos.com/matter%2Fteacher%402x.png" alt="" />
                    </div>
                    <div className="titleText">本期辅导老师：</div>
                    <div className="titleTeacher">{teacherData.teacher_name}</div>
                </div>
                <div className="contentReminder">
                    <div className="reminderTitle">验证申请时清备注学号：</div>
                    <div className="reminderNumber">{courseData.userId}</div>
                    {/* <div className="reminderButton">复制</div>   */}
                </div>
                <div className="contentRemarks">老师会在1-3天内通过验证，各位请稍安勿躁。</div>
                <div className="contentImage">
                    <img src={teacherData.teacher_data} alt="" />
                </div>
                </div>
            </div>
        )
    }

    componentDidMount() {
		// 获取 我的老师 数据
        this.props.acquirePersonalTeacherData();
        // 获取 隐藏的路由 参数
        console.log(this.props.history.location.state);
	}
}

const mapState = (state) => {
    console.log(state, '........')
    return {
        teacherData: state.personalTeacher? state.personalTeacher.teacherData: [],
        courseData: state.dengesCourse? state.dengesCourse.courseData: []
    }
};

const mapDispatch = (dispatch) => ({
	acquirePersonalTeacherData() {
        const batch_id = '20190211045'
		dispatch(actionCreators.acquirePersonalTeacherData(batch_id));
	}
});

export default connect(mapState, mapDispatch)(withRouter(PersonalTeacher));